<template>
  <div class="wh100 resize-table-container">
    <a-table class="a-base-table" :columns="table.columns" :pagination="false" :data-source="table.data" :scroll="table.scroll" bordered>
    </a-table>
    <div class="a-button-bar">
      <a-button>取消</a-button>
      <a-button type="primary">保存</a-button>
    </div>
  </div>
</template>
<script>
import table from "@/mixins/table";
export default {
  mixins: [table],
  data() {
    return {
      table: this.tableInit({
        data: [
          { name: "物料数量小数位", value: "11", key: 1 },
          { name: "物料体积小数位", value: "", key: 2 },
          { name: "物料重量小数位", value: "", key: 3 },
          { name: "物料单价小数位", value: "", key: 4 },
          { name: "开票单价小数位", value: "", key: 5 },
          { name: "件数小数位", value: "", key: 6 },
          { name: "换算率小数位", value: "", key: 7 },
          { name: "税率小数位", value: "", key: 8 }
        ],
        columns: [
          {
            title: "项目",
            width: 100,
            dataIndex: "name",
            key: "name"
          },
          {
            title: "小数位数",
            width: 100,
            dataIndex: "value",
            customRender: (text, record, index) => {
              const onChange = e => {
                this.table.data[index].value = e.target.value;
              };
              return <a-input value={text} onChange={onChange}></a-input>;
            }
          }
        ]
      })
    };
  },
  methods: {
    enabled() {
      if (this.table.selectedRows.length == 0) {
        this.$message.warning("至少选择一条数据");
      }
    }
  }
};
</script>
 
